package com.das.a2048help

class Game2048 {
    companion object {
        init {
            System.loadLibrary("a2048help")
        }
    }

    external fun nativeInit();
    external fun nativePlayGame();
    external fun nativeFindBestMove(board: Long): Int;

    fun toCBoard(m: MutableList<Int>): Long {
        var board: Long = 0
        var i = 0
        for (c in m) {
            board = board or (c.toLong() shl (4 * i))
            i += 1
        }
        return board
    }

    fun directionToStr(direction: Int): String {
        when (direction) {
            0 -> return "up"
            1 -> return "down"
            2 -> return "left"
            3 -> return "right"
        }
        return ""
    }
}